package com.briup.day08;

import com.briup.day07.Student;

/**
 * @author lining
 * @date 2024/1/17 10:14
 */
public class TestString {
    public static void main(String[] args) {
        //1.面向对象创建字符串对象
        String s = new String("abc");
        String s2 = new String("abc");
        System.out.println(s == s2);//2个引用是否指向同一个对象
        System.out.println(s.equals(s2));//输出结果是什么？由是否被重写决定，重写的后的方法逻辑 比较字符串内容是否相同

        Student st = new Student();
        Student st2 = new Student();
        System.out.println(st.equals(st2));//false?

        Integer i = new Integer(1);
        Integer i2 = new Integer(1);
        System.out.println(i.equals(i2));//输出是重写的方法逻辑
    }
}
